Skip to content

Control canonical links in load_stac_from_job#916

Open
Silvren wants to merge 2 commits into
Open-EO:masterfrom
Silvren:agent/control-job-canonical-link
Open

Control canonical links in load_stac_from_job#916
Silvren wants to merge 2 commits into
Open-EO:masterfrom
Silvren:agent/control-job-canonical-link

Conversation

@Silvren

@Silvren Silvren commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • add a keyword-only canonical_link mode to Connection.load_stac_from_job
  • preserve current behavior with "auto": prefer a canonical link and fall back to the regular results URL
  • support "require" to fail fast when no signed canonical link can be obtained
  • support "avoid" to use the regular results URL without fetching result metadata
  • validate unsupported mode values and document the new API

Testing

  • python -m pytest tests/rest/test_connection.py::TestLoadStac -q (65 passed)
  • pre-commit run --files CHANGELOG.md openeo/rest/connection.py tests/rest/test_connection.py

Fixes #634

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, thanks for you contribution

already looks good,
some notes and suggestions

Comment thread openeo/rest/connection.py Outdated
Comment thread openeo/rest/connection.py Outdated
Comment thread openeo/rest/connection.py Outdated
Comment thread CHANGELOG.md
Silvren added 2 commits July 17, 2026 16:05
# Conflicts:
#	CHANGELOG.md
@Silvren
Silvren force-pushed the agent/control-job-canonical-link branch from 2382325 to bae852d Compare July 17, 2026 08:06
@Silvren

Silvren commented Jul 17, 2026

Copy link
Copy Markdown
Author

Thanks for the review. I addressed all four suggestions:

  • renamed the argument to use_canonical_link;
  • documented it as added in 0.52.0;
  • removed the duplicate return self.load_stac(...) path;
  • moved the changelog entry to the bottom of the current Unreleased/Added list.

I also rebased onto the latest master. The focused TestLoadStac suite passes (65 tests), and Jenkins is green. This should be ready for another look.

Comment thread openeo/rest/connection.py
:param spatial_extent: limit data to specified bounding box or polygons
:param temporal_extent: limit data to specified temporal interval.
:param bands: limit data to the specified bands
:param use_canonical_link: control use of the canonical result link:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:param use_canonical_link: control use of the canonical result link:
:param use_canonical_link: control use of the canonical link:

Comment thread openeo/rest/connection.py
:param temporal_extent: limit data to specified temporal interval.
:param bands: limit data to the specified bands
:param use_canonical_link: control use of the canonical result link:
``"auto"`` prefers it but falls back to the regular job results URL,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
``"auto"`` prefers it but falls back to the regular job results URL,
``"auto"`` prefers it but falls back to the unsigned job results URL,

Comment thread openeo/rest/connection.py
:param use_canonical_link: control use of the canonical result link:
``"auto"`` prefers it but falls back to the regular job results URL,
``"require"`` fails if it is unavailable, and ``"avoid"`` always uses
the regular job results URL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the regular job results URL.
the unsigned job results URL.

Comment thread openeo/rest/connection.py
try:
job_results = job.get_results()

canonical_links = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor this logic into BatchJob.get_results_metadata_url with an additional toggle argument canonical: bool=False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

load_stac_from_job: add option to require or avoid the canonical link

2 participants